from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
    def get(self):
        ua = self.request.headers['User-Agent']
        pos = ua.find("iPhone")
        if pos < 0:
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('This application is designed for the iPhone. Please try it again with your iPhone.');
        else:
            self.redirect("/play.html")

application = webapp.WSGIApplication(
                                     [('/', MainPage)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
